<?php
	require 'conn.php';
	$query = "SELECT collectmost_shop.*, shop.* FROM collectmost_shop, shop WHERE collectmost_shop.shop_id=shop.shop_id";
	
	echo "<h2> 收藏最多 - 购物丽人</h2>";
	echo "<blockquote>";
	echo "<p>管理员可以查看，修改排行榜</p>";
	echo "</blockquote>";
	echo "<table border=1>";
	echo "<tr>";
	echo "<td>序号</td>";
	echo "<td>店铺名称</td>";
	echo "<td>店铺标题</td>";
	echo "<td>编辑</td>";
	echo "</tr>";
	
	$result = mysql_query($query);
	$num = mysql_num_rows($result);
	for ($i = 0; $i < $num; $i++) {
		$row = mysql_fetch_array($result);
		$collect_id = $row['collect_id'];
		$shopName = $row['name'];
		$shopTitle = $row['title'];
		echo "<tr>";
			echo "<td>".$collect_id."</td>";
			echo "<td>".$shopName."</td>";
			echo "<td>".$shopTitle."</td>";
			
			echo "<td>";
			echo "<form action='editCollectMostShop.php' method='post'>";
			echo "<input type='hidden' name='editId' value='$collect_id'/>";
			?>
				<select name="shopId" >
				<option value=""></option>
				<?php 
					$query2 = "SELECT shop_id, name FROM shop WHERE type=3";
					$result2 = mysql_query($query2);
					$num2 = mysql_num_rows($result2);
					for ($j = 0; $j<$num2;$j++)
					{
						$row2 = mysql_fetch_array($result2);	
						$shop_id = $row2['shop_id'];
						$shop_name = $row2['name'];
						echo "<option value=".$shop_id.">".$shop_name."</option>";					
					}
				?>
			</select>
			<?php 
			echo "<input type='submit' value='修改'/>";
			echo "</form>";
			echo "</td>";
		echo "</tr>";
	}
?>